package com.hht.toolanduilibs.wb

import android.content.ComponentName
import android.content.Context
import com.hht.toolanduilibs.ConfigurationBean
import com.hht.toolanduilibs.startActivityExt
import com.hht.toolanduilibs.startServiceExt
import java.io.File


/**
 * Author:chen'hu
 * Time:2024/9/10 14:56
 * Description:This is HhtWhiteBoard
 */
class HhtWhiteBoard(
    configurationBean: ConfigurationBean,
    private val mContext: Context,
) : WhiteBoardImp(configurationBean) {

    override fun sendPicturesToWhiteBoard(file: File?): Boolean {
        return mContext.startActivityExt {
            action = whiteBoardBean.action ?: "android.hht.action.whiteboard"
            putExtra(whiteBoardBean.putKey, file?.path)
        }
    }

    override fun openWhiteBoard(): Boolean {
        return mContext.startActivityExt {
            action = whiteBoardBean.action ?: "android.hht.action.whiteboard"
            component = ComponentName(whiteBoardBean.pkgName, whiteBoardBean.className)
        }
    }

    override fun openAnnotation(): Boolean {
        return if (annotationBean.isActivity) {
            mContext.startActivityExt {
                putExtra("extraAnnotationMode", true)
                putExtra("extraEndMeeting", false)
                putExtra("extraHideApp", false)
                component = ComponentName(annotationBean.pkgName, annotationBean.className)
            }
        } else {
            mContext.startServiceExt {
                component = ComponentName(annotationBean.pkgName, annotationBean.className)
            }
        }
    }
}